from wcs.libs.items import items
from wcs.libs.players import players

itemName = "Heavy Boots of Armor"
item = items.addItem(itemName)
item.setGroup("enhancement")
item.setCost(2000)
item.setDescription("Add thick heavy armor. +200 armor 3/4 speed")
item.aliveToUse = True
item.setMaxCount(1)

def wcs_item_bought(event_var):
    """
    Executed when an item is brought, test to see if the item bought was this
    item. If so, then we need to reduce the player's speed and increase their
    armor.
    """
    userid = event_var['userid']
    if event_var['item'] == itemName:
        player = players[userid]
        player.speed(player.maxSpeed * 0.75)
        player.armorAdd(200)